{% extends "../component/_latout.html" %}
{% block style %}
<link href="/public/admin/css/plugins/summernote/summernote.css" rel="stylesheet">
<link href="/public/admin/css/plugins/summernote/summernote-bs3.css" rel="stylesheet">

{% endblock %}
{% block content %}
<!--wrap-->
<div class="wrapper wrapper-content animated fadeInRight">
    <!--主体部分-->
    <div class="row">
        <!--左边部分-->
        <div class="col-sm-9">
          <div class="ibox float-e-margins">
              <div class="ibox-title">
                  <h5>
                  资源-资源详情</h5>
                  <div class="ibox-tools">
                    <a class="text-success" type="submit" id="close">关闭</a>
                  </div>
              </div>
              <div class="ibox-content">
                  <div class="resource_detail_imgbox">
                    {% if file.type == 1 %}
                    <img alt="image" src="{{ file.url }}">
                    {% elseif file.type == 3 %}
                    <video controls="" src="{{ file.url }}" width="640" height="360" frameborder="0"></video>
                    {% else %}
                    <div class="no-view">该类型文件不可预览</div>
                    {% endif %}
                  </div>
              </div>
          </div>
          
        </div>

        <!--右边部分-->
        <div class="col-sm-3">
          <div class="ibox float-e-margins">
              <div class="ibox-title">
                  <h5>资源信息</h5>
                  <div class="ibox-tools">
                  </div>
              </div>
              <div class="ibox-content">
                  <div class="file-info-detail">
                      <div class="clearfix  m-b-sm">
                        <strong>文件描述:</strong> 
                        {% if file.type == 1 %}
                        图片
                        {% elseif file.type == 2 %}
                        文档文件
                        {% elseif file.type == 3 %}
                        视频文件
                        {% elseif file.type == 4 %}
                        压缩文件
                        {% elseif file.type == 5 %}
                        声频文件
                        {% else %}
                        未知类型
                        {% endif %}
                      </div>
                      <div class="clearfix  m-b-sm">
                        <strong>文件类型:</strong> {{ file.mime }}
                      </div>
                      <div class="clearfix  m-b-sm">
                        <strong>文件大小:</strong> {{file.size}}
                      </div>
                      <div class="clearfix  m-b-sm">
                        <strong>归属文件夹:</strong> 
                        {% if file.folder %}
                        {{file.folder.name}}
                        {% else %}
                        根目录
                        {% endif %}
                      </div>
                      {% if file.type == 2 %}
                      <div class="clearfix  m-b-sm">
                        <strong>下载量:</strong> {{file.download}}
                      </div>
                      {% if file.mime == "application/pdf" %}
                      <div class="clearfix  m-b-sm">
                        <strong>浏览量:</strong> {{file.view}}
                      </div>
                      {% endif %}
                      {% endif %}
                      <div class="clearfix  m-b-sm">
                        <strong>创建时间:</strong> {{file.create_time}}
                      </div>
                      <div class="clearfix  m-b-sm">
                        <strong>最后修改时间:</strong> {{file.modify_time}}
                      </div>
                  </div>

              </div>
          </div>
          <div class="ibox float-e-margins">
              <div class="ibox-title">
                  <h5>资源操作</h5>
                  <div class="ibox-tools">
                  </div>
              </div>
              <div class="ibox-content">
                  <form method="get" class="form-horizontal">
                      <div class="form-group">
                          <label class="col-sm-3 control-label">url</label>

                          <div class="col-sm-9">
                              <input type="text" value="{{file.url}}" class="form-control" disabled>
                          </div>
                      </div>
                      <div class="form-group">
                          <label class="col-sm-3 control-label">名称</label>
                          <div class="col-sm-9">
                              <input type="text" class="form-control" value="{{file.name}}" disabled>
                          </div>
                      </div>
                      <div class="form-group tx-c">
                        <label class="col-sm-3 control-label"></label>
                        <div class="col-sm-9 clearfix">
                          {# <button class="btn btn-primary pull-right m-l" type="button">更新</button> #}
                          {# <button class="btn btn-danger pull-right m-l" type="button">删除资源</button> #}
                        </div>
                      </div>
                    </form>
              </div>
          </div>
          {% if file.type == 2 %}
          <!--下载与浏览只有文档才有以下显示项-->
          {% if file.mime == "application/pdf" %}
          <div class="ibox float-e-margins">
              <div class="ibox-title">
                  <h5>最近浏览</h5>
                  <div class="ibox-tools">
                      <a tabname="文件最近浏览 | {{file.name}}" class="J_menuItem"  href="/admin/operation/list?type=2&targetType=2&targetId={{file.id}}" >
                          查看更多
                      </a>
                  </div>
              </div>
              <div class="ibox-content">
                  <div class="row">
                    {% for log in viewLogs %}
                    <div class="col-sm-3 tx-c m-b no-padding" >
                      <div class="img-container m-b-xs">
                        <img class="img-circle" src="{{ log.user.avatar }}"  width="40" height="40">
                      </div>
                      {{ log.user.real_name }}
                    </div>
                    {% else %}
                    <!--没有数据时的显示-->
                    <div class="no-data-container">
                      <i class="fa fa-frown-o"></i>
                      <span>暂时还没有浏览记录哦~</span>
                    </div>
                    <!--/没有数据时的显示-->
                    {% endfor %}
                  </div>
              </div>
          </div>
          {% endif %}
          <div class="ibox float-e-margins">
              <div class="ibox-title">
                  <h5>最近下载</h5>
                  <div class="ibox-tools">
                      <a tabname="文件最近下载 | {{file.name}}" class="J_menuItem" href="/admin/operation/list?type=1&targetType=2&targetId={{file.id}}">
                          查看更多
                      </a>
                  </div>
              </div>
              <div class="ibox-content">
                  <div class="row">
                    {% for log in downloadLogs %}
                    <div class="col-sm-3 tx-c m-b no-padding" >
                      <div class="img-container m-b-xs">
                        <img class="img-circle" src="{{ log.user.avatar }}"  width="40" height="40">
                      </div>
                      {{ log.user.real_name }}
                    </div>
                    {% else %}
                    <!--没有数据时的显示-->
                    <div class="no-data-container">
                      <i class="fa fa-frown-o"></i>
                      <span>暂时还没有下载记录哦~</span>
                    </div>
                    <!--/没有数据时的显示-->
                    {% endfor %}
                  </div>
              </div>
          </div>
          {% endif %}
        </div>
    </div>
    <!--/主体部分-->
    <!--浏览记录部分-->
    {% if file.type == 1 %}
    {# <div class="row">
        <!--左边部分-->
        <div class="col-sm-6">
          
          <!--下载与浏览只有文档才有以下显示项-->
          <div class="ibox float-e-margins">
              <div class="ibox-title">
                  <h5>最近浏览</h5>
                  <div class="ibox-tools">
                      <a href="/admin/operation/list">
                          查看更多
                      </a>
                  </div>
              </div>
              <div class="ibox-content">
                  <div class="row">
                    {% for log in viewLogs %}
                    <div class="col-sm-3 tx-c m-b no-padding" >
                      <div class="img-container m-b-xs">
                        <img class="img-circle" src="{{ log.user.avatar }}"  width="40" height="40">
                      </div>
                      {{ log.user.real_name }}
                    </div>
                    {% else %}
                    <!--没有数据时的显示-->
                    <div class="no-data-container">
                      <i class="fa fa-frown-o"></i>
                      <span>您暂时还没有读者哦~</span>
                    </div>
                    <!--/没有数据时的显示-->
                    {% endfor %}
                  </div>
              </div>
          </div>
        </div>
        <!--右边部分-->
        <div class="col-sm-6">
          <div class="ibox float-e-margins">
              <div class="ibox-title">
                  <h5>最近下载</h5>
                  <div class="ibox-tools">
                      <a href="/admin/operation/list">
                          查看更多
                      </a>
                  </div>
              </div>
              <div class="ibox-content">
                  <div class="row">
                    {% for log in downloadLogs %}
                    <div class="col-sm-3 tx-c m-b no-padding" >
                      <div class="img-container m-b-xs">
                        <img class="img-circle" src="{{ log.user.avatar }}"  width="40" height="40">
                      </div>
                      {{ log.user.real_name }}
                    </div>
                    {% else %}
                    <!--没有数据时的显示-->
                    <div class="no-data-container">
                      <i class="fa fa-frown-o"></i>
                      <span>您暂时还没有读者哦~</span>
                    </div>
                    <!--/没有数据时的显示-->
                    {% endfor %}
                  </div>
              </div>
          </div>
        </div>
    </div> #}
    <!--/浏览记录部分-->
    {% endif %}
</div>

{% endblock %} 
{% block script %}
<script src="/public/admin/js/plugins/summernote/summernote.min.js"></script>
<script src="/public/admin/js/plugins/summernote/summernote-zh-CN.js"></script>
<script src="/public/admin/js/common/resource/detail.js"></script>
{% endblock %} 
